{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "%matplotlib inline\n",
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<style>body {\n",
       "    margin: 0;\n",
       "    font-family: Helvetica;\n",
       "}\n",
       "table.dataframe {\n",
       "    border-collapse: collapse;\n",
       "    border: none;\n",
       "}\n",
       "table.dataframe tr {\n",
       "    border: none;\n",
       "}\n",
       "table.dataframe td, table.dataframe th {\n",
       "    margin: 0;\n",
       "    border: 1px solid white;\n",
       "    padding-left: 0.25em;\n",
       "    padding-right: 0.25em;\n",
       "}\n",
       "table.dataframe th:not(:empty) {\n",
       "    background-color: #fec;\n",
       "    text-align: left;\n",
       "    font-weight: normal;\n",
       "}\n",
       "table.dataframe tr:nth-child(2) th:empty {\n",
       "    border-left: none;\n",
       "    border-right: 1px dashed #888;\n",
       "}\n",
       "table.dataframe td {\n",
       "    border: 2px solid #ccf;\n",
       "    background-color: #f4f4ff;\n",
       "}\n",
       "h3 {\n",
       "    color: white;\n",
       "    background-color: black;\n",
       "    padding: 0.5em;\n",
       "}\n",
       "</style>"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from IPython.core.display import HTML\n",
    "css = open('style-table.css').read() + open('style-notebook.css').read()\n",
    "HTML('<style>{}</style>'.format(css))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>title</th>\n",
       "      <th>year</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Tomorrow Ends at Dawn</td>\n",
       "      <td>2002</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Brothers of the West</td>\n",
       "      <td>1937</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Nemo</td>\n",
       "      <td>1984</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Pereezd</td>\n",
       "      <td>2014</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Bad for Business</td>\n",
       "      <td>2007</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                   title  year\n",
       "0  Tomorrow Ends at Dawn  2002\n",
       "1   Brothers of the West  1937\n",
       "2                   Nemo  1984\n",
       "3                Pereezd  2014\n",
       "4       Bad for Business  2007"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "titles = pd.read_csv('data/titles.csv')\n",
    "titles.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>title</th>\n",
       "      <th>year</th>\n",
       "      <th>name</th>\n",
       "      <th>type</th>\n",
       "      <th>character</th>\n",
       "      <th>n</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Suuri illusioni</td>\n",
       "      <td>1985</td>\n",
       "      <td>Homo $</td>\n",
       "      <td>actor</td>\n",
       "      <td>Guests</td>\n",
       "      <td>22</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Gangsta Rap: The Glockumentary</td>\n",
       "      <td>2007</td>\n",
       "      <td>Too $hort</td>\n",
       "      <td>actor</td>\n",
       "      <td>Himself</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Menace II Society</td>\n",
       "      <td>1993</td>\n",
       "      <td>Too $hort</td>\n",
       "      <td>actor</td>\n",
       "      <td>Lew-Loc</td>\n",
       "      <td>27</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Porndogs: The Adventures of Sadie</td>\n",
       "      <td>2009</td>\n",
       "      <td>Too $hort</td>\n",
       "      <td>actor</td>\n",
       "      <td>Bosco</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Stop Pepper Palmer</td>\n",
       "      <td>2014</td>\n",
       "      <td>Too $hort</td>\n",
       "      <td>actor</td>\n",
       "      <td>Himself</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                               title  year       name   type character   n\n",
       "0                    Suuri illusioni  1985     Homo $  actor    Guests  22\n",
       "1     Gangsta Rap: The Glockumentary  2007  Too $hort  actor   Himself NaN\n",
       "2                  Menace II Society  1993  Too $hort  actor   Lew-Loc  27\n",
       "3  Porndogs: The Adventures of Sadie  2009  Too $hort  actor     Bosco   3\n",
       "4                 Stop Pepper Palmer  2014  Too $hort  actor   Himself NaN"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "cast = pd.read_csv('data/cast.csv')\n",
    "cast.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.axes._subplots.AxesSubplot at 0x7fa259c41978>"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX8AAAEdCAYAAADkeGc2AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAH0BJREFUeJzt3Xu0XGWd5vHvI5GLyIBp6XARgRnDQGwdBCX2TY6idP7o\nAVztQOzRAc04thkHbEeH4JppcVY3Ak43gz1D1vQ0dAAVyZJG7REDATl9sYUIEkFimmAbJAECRi7e\nJfDMH/s9SeV0VXJOXVK1dz2ftWrV3u/e9ey3zqnz1q7f3rWPbBMREePlBcPuQERE7HkZ/CMixlAG\n/4iIMZTBPyJiDGXwj4gYQxn8IyLG0IwGf0kHSfqcpG9LWidpoaS5klZLekDSLZIOaln/AkkbJK2X\ndGpL+4mS7ivLLm9p30fS9aX9DklH9vdpRkREq5nu+V8O3GT7OODVwHpgGbDa9jHAbWUeSQuAs4AF\nwCLgCkkqOcuBJbbnA/MlLSrtS4Ctpf0y4JKen1lERHS028Ff0oHAb9q+CsD2NttPA6cBV5fVrgbO\nKNOnA9fZftb2RuBBYKGkQ4EDbK8p613T8pjWrBuAU3p6VhERsUsz2fM/GnhC0l9I+oak/ytpf2Ce\n7S1lnS3AvDJ9GLCp5fGbgMPbtG8u7ZT7h6F6cwGeljS3mycUERG7N5PBfw5wAnCF7ROAH1NKPFNc\nXSMi14mIiKiJOTNYZxOwyfbXy/zngAuAxyQdYvuxUtJ5vCzfDBzR8viXlYzNZXp6+9RjXg48ImkO\ncKDtH7R2QlLeXCIiumBb7Rp3ewP+BjimTF8IXFpu55e2ZcDFZXoBsBbYm6pk9B1AZdmdwEJAwE3A\notK+FFhephcDn23TB8+kry3rXzib9Wd7S/7w8uvc9+Qnf0/ndxo7Z7LnD/Cfg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nuMP28bb78cWliL5owpe8IvrO9kOStko6nuoa6vdQDeynSpr6UtL+wCuAvwXOU/WP5gGOAOYDa4Dn\ngBv2aOcjZiCDf0Rnfw68i+o6M1cBpwAft73TtyslTZRlr7f9M0m3A/uWxT9zvkkZIyhln4jObqS6\n9sxrgVXAzcC7Je0PIOlwSQcD/wx4sgz8x5LaftRA9vwjOijXUfkK1cBuYLWk44CvSQL4IfAOqjeG\n35O0jur6619rjdnD3Y6YkVzbJ6KDcqD3buBttr8z7P5E9FPKPhFtSFoAbKD6R9kZ+KNxsucfETGG\nsucfETGGMvhHRIyhDP4REWMog39ExBjK4B8RMYYy+EdEjKH/D99AFgdHHsqVAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x7fa259c41f28>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Using groupby(), plot the number of films\n",
    "# that have been released each decade in the history of cinema.\n",
    "\n",
    "t = titles\n",
    "t.groupby(t.year // 10 * 10).size().plot(kind='bar')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.axes._subplots.AxesSubplot at 0x7fa26f513518>"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXAAAAEdCAYAAAAVczy7AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAH5pJREFUeJzt3XuQZGd53/HvT1pUXIStEJwFJMWrBHFRBbxCWGzERSPH\nELFFCVIhARLAC1X2plRboopAwJRSESm7sOMLAkeAUkZZcCVSCDYqyayswqCXIC4LknaWFSthyTD2\nShiBLS0gFsxFT/4472h7Wz3TPb19+jxn5vep2to+fc6e/qq79c7MMz09igjMzKx/Tug6wMzMpuMF\n3Mysp7yAm5n1lBdwM7Oe8gJuZtZTX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4BH190/DP+0myXlEYqtZx+jea+O5wJ/BtwIvFHS4wAknSrp54CfAR6oi/cz\n8KzbesKfgdu6Vd+L4lM0i3MAn5D0TODzkgC+B7yWZnH/D5IO0ryn8+cHTzPnbLOJ+b1QbN2q37y8\nFXhlRPxl1z1ms+YRiq1Lks4C7qL5hbJevG1d8mfgZmY95c/Azcx6ygu4mVlPeQE3M+spL+BmZj3l\nBdzMrKe8gJuZ9dT/BxT1noPbB61OAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x7fa26f4ff358>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Use groupby() to plot the number of \"Hamlet\" films made each decade.\n",
    "\n",
    "t = titles\n",
    "t = t[t.title == 'Hamlet']\n",
    "t.groupby(t.year // 10 * 10).size().plot(kind='bar')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "year  type   \n",
       "1950  actor      603\n",
       "      actress    267\n",
       "1951  actor      626\n",
       "      actress    272\n",
       "1952  actor      590\n",
       "      actress    282\n",
       "1953  actor      629\n",
       "      actress    283\n",
       "1954  actor      620\n",
       "      actress    298\n",
       "1955  actor      602\n",
       "      actress    263\n",
       "1956  actor      609\n",
       "      actress    284\n",
       "1957  actor      703\n",
       "      actress    281\n",
       "1958  actor      695\n",
       "      actress    273\n",
       "1959  actor      672\n",
       "      actress    286\n",
       "dtype: int64"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# How many leading (n=1) roles were available to actors,\n",
    "# and how many to actresses, in each year of the 1950s?\n",
    "\n",
    "c = cast\n",
    "c = c[c.year // 10 == 195]\n",
    "c = c[c.n == 1]\n",
    "c.groupby(['year', 'type']).size()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "n  type   \n",
       "1  actor      6349\n",
       "   actress    2789\n",
       "2  actor      4354\n",
       "   actress    4375\n",
       "3  actor      5370\n",
       "   actress    3005\n",
       "4  actor      5370\n",
       "   actress    2735\n",
       "5  actor      5403\n",
       "   actress    2426\n",
       "dtype: int64"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# In the 1950s decade taken as a whole,\n",
    "# how many total roles were available to actors,\n",
    "# and how many to actresses, for each \"n\" number 1 through 5?\n",
    "\n",
    "c = cast\n",
    "c = c[c.year // 10 * 10 == 1950]\n",
    "c = c[c.n < 6]\n",
    "c.groupby(['n', 'type']).size()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>n</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>year</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1963</th>\n",
       "      <td>15</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2006</th>\n",
       "      <td>50</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "       n\n",
       "year    \n",
       "1963  15\n",
       "2006  50"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Use groupby() to determine how many roles are listed\n",
    "# for each movie named _The Pink Panther_.\n",
    "\n",
    "c = cast\n",
    "c = c[c.title == 'The Pink Panther']\n",
    "c = c.sort_values('n').groupby(['year'])[['n']].max()\n",
    "c"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "year  title                                   \n",
       "1979  The Muppet Movie                            8\n",
       "1981  An American Werewolf in London              2\n",
       "      The Great Muppet Caper                      6\n",
       "1982  The Dark Crystal                            2\n",
       "1984  The Muppets Take Manhattan                  7\n",
       "1985  Sesame Street Presents: Follow that Bird    3\n",
       "1992  The Muppet Christmas Carol                  7\n",
       "1996  Muppet Treasure Island                      4\n",
       "1999  Muppets from Space                          4\n",
       "      The Adventures of Elmo in Grouchland        3\n",
       "dtype: int64"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# List, in order by year, each of the films\n",
    "# in which Frank Oz has played more than 1 role.\n",
    "\n",
    "c = cast\n",
    "c = c[c.name == 'Frank Oz']\n",
    "g = c.groupby(['year', 'title']).size()\n",
    "g[g > 1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "character\n",
       "Grover            2\n",
       "Bert              3\n",
       "Cookie Monster    3\n",
       "Fozzie Bear       4\n",
       "Sam the Eagle     5\n",
       "Yoda              5\n",
       "Animal            6\n",
       "Miss Piggy        6\n",
       "dtype: int64"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# List each of the characters that Frank Oz\n",
    "# has portrayed at least twice.\n",
    "\n",
    "c = cast\n",
    "c = c[c.name == 'Frank Oz']\n",
    "g = c.groupby(['character']).size()\n",
    "g[g > 1].sort_values()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.4.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
